\documentclass[mainfile]{subfiles}
\begin{document}
\section{Middle}\label{sec:middle}
Given \ref{sec:intro}, we find the middle stuff.
\end{document}
